/*
 * Main.cpp
 *
 *  Created on: 2012-6-6
 *      Author: Administrator
 */
#include<deque>
#include"LRU.h"
#include"FIFO.h"
#include<iostream>
using namespace std;
void simulate(deque<int> &pa, int n) {
	for (int i = 1; i <= n; ++i) {
		LRU lru(i);
		FIFO fifo(i);
		for (deque<int>::const_iterator iter = pa.begin(); iter != pa.end();
				++iter) {
			lru.access(*iter);
			fifo.access(*iter);
		}
		cout << "n=" << i << endl;
		cout << "\tLRU time cost:" << lru.getTimecost() << endl;
		cout << "\tFIFO time cost:" << fifo.getTimecost() << endl;
	}
}

int main() {
	int addr[]={3,2,3,1,4,3,5,4,1,4};
	int len=10;
	deque<int> pa;
	for(int i=0;i<len;i++){
		pa.push_back(addr[i]);
	}
	simulate(pa,5);
	return 0;
}

